# 判断题  ,j

import re
import xlwt

with open("qq.txt", encoding='utf-8') as f:
    text = f.read()
data_list = re.findall(r'\d*\.\((X|,J)\)(.*?)。',text)

ques = []
ans = []

for i in data_list:
    ques.append(i[1])
    ans.append(i[0])

# 写入Excel
workbook = xlwt.Workbook(encoding='ascii')
worksheet = workbook.add_sheet('My Worksheet')


for i in range(len(ques)):
    worksheet.write(i, 2, ques[i])
    worksheet.write(i, 1, ans[i])
workbook.save('formatting.xls')
